<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>09.继承</title>
</head>
<body>

    <script>
          function Student(id,name) {
              // new Person(id,name,this)
              // 调用Person的时候 需要改变Person 的this指向
              Person.call(this,id,name)
          
           
          }
          // 继承
          Student.prototype = new Person();
          Student.prototype.say = function() {
             console.log(this.name + "在说话.....");
          }

          function Person(id,name) {
            this.id = id
            this.name = name
          }
          Person.prototype.eat = function() {
             console.log(this.name+"在吃饭.....");
          }

          var stu = new Student("1001","小明");
          stu.say()
          stu.eat()
    </script>
    
</body>
</html>